<?php

/* @var $this yii\web\View */

use common\widgets\JsBlock;
$this->title = '收款'
?>
<div id="form">
	<div class="weui-cells weui-cells_form">
		<div class="weui-cell">
			<div class="weui-cell__hd"><label class="weui-label">账户</label></div>
			<div class="weui-cell__bd">
				<input class="weui-input" type="tel" required="" pattern="^\d{11}$" maxlength="11" placeholder="输入对方的手机号" emptytips="请输入手机号" notmatchtips="请输入正确的手机号">
			</div>
			<div class="weui-cell__ft"> <i class="weui-icon-warn"></i></div>
		</div>
		<div class="weui-cell">
			<div class="weui-cell__hd"><label class="weui-label">金额</label></div>
			<div class="weui-cell__bd">
				<input class="weui-input" required="" pattern="^(([1-9]\d{0,9})|0)(\.\d{1,2})?$" maxlength="11" placeholder="输入金额" emptytips="请输入金额" notmatchtips="请输入正确的金额">
			</div>
			<div class="weui-cell__ft"><i class="weui-icon-warn"></i></div>
		</div>
		<div class="weui-cells__title">理由</div>
		<div class="weui-cells weui-cells_form" >
			<div class="weui-cell">
				<div class="weui-cell__bd">
					<textarea class="weui-textarea" placeholder="输入理由" rows="8" required></textarea>
<!--					<div class="weui-textarea-counter"><span>0</span>/200</div>-->
				</div>
			</div>
		</div>

	</div>
	<div class="weui-btn-area">
		<a id="formSubmitBtn" href="javascript:" class="weui-btn weui-btn_primary">确认收款</a>
	</div>
</div>


<?php JsBlock::begin() ?>
<script >
	$(function(){
		/* form */
// 约定正则
		var regexp = {
			regexp: {
				IDNUM: /(?:^\d{15}$)|(?:^\d{18}$)|^\d{17}[\dXx]$/,
				VCODE: /^.{4}$/
			}
		};

// 失去焦点时检测
		weui.form.checkIfBlur('#form', regexp);

// 表单提交
		document.querySelector('#formSubmitBtn').addEventListener('click', function () {
			console.log(1);
			weui.form.validate('#form', function (error) {
				console.log(error);
				if (!error) {
					var loading = weui.loading('提交中...');
					setTimeout(function () {
						loading.hide();
						weui.toast('提交成功', 3000);
					}, 1500);
				}
				console.log(2);
			}, regexp);
		});
	})
</script>
<?php JsBlock::end()?>